package com.hzncc.flowable_diboot.project_contracts.dto;

import com.diboot.core.binding.query.BindQuery;
import com.diboot.core.binding.query.Comparison;
import com.diboot.iam.entity.IamOrg;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.project_contracts.entity.ProjectContractAmount;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

        import com.hzncc.flowable_diboot.project_contracts.entity.ProjectContractAudit;
/**
* 项目类合同金额 DTO定义
*
* @author MyName
* @version 1.0
* @date 2024-09-24
 * Copyright © MyCorp
*/
@Getter
@Setter
@Accessors(chain = true)
public class ProjectContractAmountDTO extends ProjectContractAmount  {
private static final long serialVersionUID = 1989144852677884088L;

        /**
        * 合同采购总金额 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "contract_purchase_total_amount")
        private BigDecimal contractPurchaseTotalAmountBegin;

        /**
        * 合同采购总金额 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "contract_purchase_total_amount")
        private BigDecimal contractPurchaseTotalAmountEnd;
        /**
        * 合同销售总金额 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "contract_sales_total_amount")
        private BigDecimal contractSalesTotalAmountBegin;

        /**
        * 合同销售总金额 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "contract_sales_total_amount")
        private BigDecimal contractSalesTotalAmountEnd;
        /**
        * 折扣/毛利% 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "discount")
        private BigDecimal discountBegin;

        /**
        * 折扣/毛利% 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "discount")
        private BigDecimal discountEnd;
        /**
        * 合同退税总价 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "contract_tax_refund_total_price")
        private BigDecimal contractTaxRefundTotalPriceBegin;

        /**
        * 合同退税总价 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "contract_tax_refund_total_price")
        private BigDecimal contractTaxRefundTotalPriceEnd;
        /**
        * 综合毛利 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "comprehensive_gross_profit")
        private BigDecimal comprehensiveGrossProfitBegin;

        /**
        * 综合毛利 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "comprehensive_gross_profit")
        private BigDecimal comprehensiveGrossProfitEnd;
        /**
        * 退税收毛利率% 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "tax_refund_gross_profit_margin_percentage")
        private BigDecimal taxRefundGrossProfitMarginPercentageBegin;

        /**
        * 退税收毛利率% 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "tax_refund_gross_profit_margin_percentage")
        private BigDecimal taxRefundGrossProfitMarginPercentageEnd;
        /**
        * 已收款金额 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "collected_amount")
        private BigDecimal collectedAmountBegin;

        /**
        * 已收款金额 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "collected_amount")
        private BigDecimal collectedAmountEnd;
        /**
        * 未收款金额 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "uncollected_amount")
        private BigDecimal uncollectedAmountBegin;

        /**
        * 未收款金额 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "uncollected_amount")
        private BigDecimal uncollectedAmountEnd;
        /**
        * 实际合同销售总价 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "actual_contract_sales_total_price")
        private BigDecimal actualContractSalesTotalPriceBegin;

        /**
        * 实际合同销售总价 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "actual_contract_sales_total_price")
        private BigDecimal actualContractSalesTotalPriceEnd;
        /**
        * 汇率 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "exchange_rate")
        private BigDecimal exchangeRateBegin;

        /**
        * 汇率 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "exchange_rate")
        private BigDecimal exchangeRateEnd;
        /**
        * 要求完成时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime requiredCompletionTime;
        /**
        * 要求完成时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "required_completion_time")
        private LocalDate requiredCompletionTimeBegin;

        /**
        * 要求完成时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "required_completion_time")
        private LocalDate requiredCompletionTimeEnd;
        /**
        * 创建时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime createTime;
        /**
        * 创建时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "create_time")
        private LocalDate createTimeBegin;

        /**
        * 创建时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "create_time")
        private LocalDate createTimeEnd;
        /**
        * 更新时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime updateTime;
        /**
        * 更新时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "update_time")
        private LocalDate updateTimeBegin;

        /**
        * 更新时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "update_time")
        private LocalDate updateTimeEnd;

        public LocalDate getRequiredCompletionTimeEnd() {
            if (getRequiredCompletionTime() != null) {
                return getRequiredCompletionTime().plusDays(1).toLocalDate();
            }
            if (requiredCompletionTimeEnd != null) {
                return requiredCompletionTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getCreateTimeEnd() {
            if (getCreateTime() != null) {
                return getCreateTime().plusDays(1).toLocalDate();
            }
            if (createTimeEnd != null) {
                return createTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getUpdateTimeEnd() {
            if (getUpdateTime() != null) {
                return getUpdateTime().plusDays(1).toLocalDate();
            }
            if (updateTimeEnd != null) {
                return updateTimeEnd.plusDays(1);
            }
            return null;
        }

}